import { usb } from 'usb';

const watchUsb = async (win) => {
    // 监听设备连接
    usb.on('attach', (device) => {
        win.webContents.send('usbChange', { status: 'attach', device });
    });
    // 监听设备断开
    usb.on('detach', (device) => {
        win.webContents.send('usbChange', { status: 'detach', device })
    });
}

export default watchUsb;